home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group03a.txt / 000013_icon-group-sender_Wed Feb 12 08:13:31 2003.msg < prev    next >
Internet Message Format  |  2003-12-22  |  2KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id h1CFDUh14835
  4.     for icon-group-addresses; Wed, 12 Feb 2003 08:13:30 -0700 (MST)
  5. Message-Id: <200302121513.h1CFDUh14835@baskerville.CS.Arizona.EDU>
  6. X-Sender: whm@mail.mse.com (Unverified)
  7. Date: Wed, 12 Feb 2003 01:15:06 -0700
  8. To: ernobe <ernobe@yahoo.com>
  9. From: "William H. Mitchell" <whm@mse.com>
  10. Subject: Re: data values
  11. Cc: icon-group@cs.arizona.edu
  12. Errors-To: icon-group-errors@cs.arizona.edu
  13. Status: RO
  14.  
  15. At 05:02 PM 2/11/03 -0600, ernobe wrote:
  16. >> 
  17. >The whole section immediately following, entitled "Data Backtracking"
  18. >might as well be paraphrased as "There is such a thing as data
  19. >backtracking".  Would it be right to conclude from it that the success
  20. >of expressions in a logical conjunction does not depend on the success
  21. >of the final expression, while the success of the conjunction as a whole
  22. >does? 
  23.  
  24. It sounds like you've got the right understanding about that.
  25.  
  26. An important thing to understand about the "&" is that it is simply a
  27. trivial operator.  If it weren't in the language, you could mimic it with
  28. this procedure:
  29.  
  30.    procedure and(e1, e2)
  31.       return e2
  32.    end
  33.  
  34. Instead of 'x < 10 & y < 20', you might write 'and(x < 10, y < 20)'.  In
  35. both cases, if x < 10 fails, y < 20 is never evaluated.  The underlying
  36. principle is that if an evaluation of an operand (or argument) fails, the
  37. operator (or procedure) is never called.  Likewise, in '(x < 10) + (y <
  38. 20)', if x < 10 fails, the second comparison and the addition are just
  39. never done.
  40.  
  41. I point out to students that in a conventional language implementation of
  42. logical conjunction and logical disjunction is pretty similar.  In Icon,
  43. implementation of the analagous elements, & and |, are at opposite ends of
  44. the difficulty spectrum.
  45.